package com.arpa.wms.service;

import com.arpa.core.web.Result;
import com.arpa.wms.domain.dto.ReceiveRegisterDTO;
import com.arpa.wms.domain.entity.ReceiveRegister;
import com.arpa.wms.domain.vo.ReceiveItemVO;
import com.arpa.wms.domain.vo.ReceiveRegisterVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;

/**
 * <p>
 * 收货登记 服务类
 * </p>
 *
 * @author LEO
 * @since 2020-08-04
 */
public interface IReceiveRegisterService extends IService<ReceiveRegister> {

    /**
     * 保存
     * @param entity
     * @return
     */
    @Override
    boolean save(ReceiveRegister entity);

    /**
     * 根据code更新实体
     * @param entity
     * @return
     */
    int updateByCode(ReceiveRegister entity);

    /**
     * 查询列表
     * @param receiveRegisterDTO
     * @return
     */
    List<ReceiveRegisterVO> queryList(ReceiveRegisterDTO receiveRegisterDTO);
     /**
      *  @author: Allen chen
      *  @Date: 2020/9/30 9:06
      *  @Description: 根据库存状态批量查询数据
      */
    List<ReceiveRegisterVO> queryByInventoryStatus(List<String> statusList);

    /**
     * 查询合计,包含总数
     * @param receiveRegisterDTO
     * @return
     */
    ReceiveRegisterVO queryListSum(ReceiveRegisterDTO receiveRegisterDTO);

    ReceiveRegisterVO getOneByCode(String code);

    List<ReceiveRegister> queryAllList(LambdaQueryWrapper<ReceiveRegister> eq);

    /**
     * pda收货登记
     * @param register
     * @return
     */
    Result pdaSaveRegister(ReceiveRegister register);

    Result saveRegister(ReceiveRegister register);

    /**
     * 根据上架单code更新批号、存货日期
     * @param code
     * @return
     */
    int updateInventoryInfoByPutawayCode(String code,String groupCode);

    Result wholeConfirm(ReceiveRegister register);

    /**
     * 统计上架明细单上架数量，更新指定收货确认单的上架数量
     * @param receiveRegisterCode
     */
    void refreshPutawayQuantity(String receiveRegisterCode);

    /**
     * 统计上架明细单上架数量，更新指定收货确认单的上架数量和入库数量
     * @param receiveRegisterCode
     */
    void refreshPutawayAndInboundQuantity(String receiveRegisterCode);

    /**
     * 根据register信息判断数据库中是否有相同数据
     * @param register
     * @return
     */
    ReceiveRegister getSameDBRegister(ReceiveRegister register);

    /**
     * 一键收货
     * @param receiveItemVOS
     * @return
     */
    Result batchCreate(List<ReceiveItemVO> receiveItemVOS);

}
